﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DDD;
using Xunit;

using Vector3 = DDD.Vector3<float>;

namespace DokiDokiTest {
    public class TestLightMaterial {
        [Fact]
        public void Test_New1 () {
            var mat = new LightMaterial ();

            Assert.Equal (new Vector3 (1, 1, 1), mat.Color);
            Assert.Equal (1.0f, mat.Intensity);
            Assert.Equal (new Vector3 (1, 0, 0), mat.Attenuation);
            Assert.Equal (1.0f, mat.ConstantAttenuation);
            Assert.Equal (0, mat.LinearAttenuation);
            Assert.Equal (0, mat.QuadraticAttenuation);
            Assert.Equal (90, mat.SpotAngle);
            Assert.Equal (10, mat.SpotExponential);
        }

        [Fact]
        public void Test_SetColor () {
            var mat = new LightMaterial ();
            mat.SetColor (0.1f, 0.2f, 0.3f);

            Assert.Equal (new Vector3 (0.1f, 0.2f, 0.3f), mat.Color);
        }

        [Fact]
        public void Test_SetIntensity () {
            var mat = new LightMaterial ();
            mat.SetIntensity (2);

            Assert.Equal (2, mat.Intensity);
        }

        [Fact]
        public void Test_SetAttenuation () {
            var mat = new LightMaterial ();

            mat.SetAttenuation (1, 2, 3);

            Assert.Equal (new Vector3 (1, 2, 3), mat.Attenuation);
            Assert.Equal (1, mat.ConstantAttenuation);
            Assert.Equal (2, mat.LinearAttenuation);
            Assert.Equal (3, mat.QuadraticAttenuation);
        }

        [Fact]
        public void Test_SetSpotParameter () {
            var mat = new LightMaterial ();
            mat.SetSpotParameter (1, 2);

            Assert.Equal (1, mat.SpotAngle);
            Assert.Equal (2, mat.SpotExponential);
        }
    }
}
